home *** CD-ROM | disk | FTP | other *** search
- property sprMe
- property vel, velMax, velMin, jmpMax
- property memParada, intParada
-
- property esperaMax, esperaMin, espera -- Espera entre aparicoes
-
- property lastMove, posX, direcao
-
- property parado, ultimoClick
-
- on getBehaviorDescription
- return "Anima sprites"
- end
-
- on getPropertyDescriptionList
- set p_list = [ ¬
- #velMax: [ #comment: "Velocidade maxima (pixels/s)", ¬
- #format: #integer, ¬
- #default: 640 ], ¬
- #velMin: [ #comment: "Velocidade minima (pixels/s)", ¬
- #format: #integer, ¬
- #default: 100 ], ¬
- #jmpMax: [ #comment: "Maior pulo (em pixels) permitido",¬
- #format: #integer,¬
- #default: 16 ],¬
- #memParada: [ #comment: "Bola parada",¬
- #format: #string,¬
- #default: "bola1" ],¬
- #esperaMax: [ #comment: "Tempo maximo de espera entre cada aparicao (1/60 segundos)", ¬
- #format: #integer, ¬
- #default: 180 ], ¬
- #esperaMin: [ #comment: "Tempo minimo de espera entre cada aparicao (1/60 segundos)", ¬
- #format: #integer, ¬
- #default: 30 ] ¬
- ]
- return p_list
- end
-
- on beginSprite me
- set sprMe to the spriteNum of me
- set intParada to the number of member memParada
- set lastMove to the timer
- set direcao to 0
- set espera to random(esperaMax - esperaMin + 1) - 1 + esperaMin
- set the locH of sprite sprMe to -100
- set parado = false
- set ultimoClick = the timer - 60
- puppetSprite sprMe,true
- end
-
- on bolaAleatoria me
- set the locH of sprite sprMe to random(960) - 180
- set lastMove = 0
- set direcao to (random(2)-1)*2 - 1
- set vel to random(velMax-velMin + 1) - 1 + velMin
- set posX = the locH of sprite sprMe
- end
-
- on cleanSprite
- global gPronde
- if gPronde <> 2000 then
- puppetSprite sprMe, false
- end if
- end
-
- on stopBola me
- set parado = true
- set lastMove = the timer - lastMove
- set the member of sprite sprMe to intParada
- end
-
- on continueBola me
- set parado = false
- set lastMove = the timer
- set the member of sprite sprMe to member "bola"
- end
-
- on mouseDown me
- global gPronde
- set gPronde = 2000
- calculaDonde
- if parado then
- if the timer - ultimoClick < 30 then return
- sendAllSprites(#cleanSprite)
- go marker("Melhores Momentos")
- updateStage
- sendAllSprites(#continueBola)
- else
- sendAllSprites(#stopBola)
- sendAllSprites(#cleanSprite)
- global gMelhoresTabela, gNumMelhores
- set tmp = getAt(gMelhoresTabela, gNumMelhores)
- set gNumMelhores = gNumMelhores + 1
- if (gNumMelhores > 9) then MelhoresEmbaralha
- vaiMelhores tmp
-
- end if
- updateStage
- set ultimoClick = the timer
- end
-
- on idleSprite me
- global gMustUpdate
- if parado then return
-
- if direcao = 0 then -- Bola aguardando
- if the timer - lastMove > espera then
- set gMustUpdate to true
- set direcao to (random(2)-1)*2 - 1
- set vel to random(velMax-velMin + 1) - 1 + velMin
- set lastMove to the timer
- if direcao = 1 then
- set the locH of sprite sprMe to -10
- set posX to -10
- else
- set the locH of sprite sprMe to 650
- set posX to 650
- end if
- end if
-
- else -- Bola movendo
- set dx = (the timer - lastMove) * vel / 60
- if (dx > 0) then
- if (dx > jmpMax) then set dx to jmpMax
- set posX to posX + dx * direcao
- set gMustUpdate to true
- set the locH of sprite sprMe to posX
- if posX > 650 or posX < -10 then
- set direcao = 0
- set espera to random(esperaMax - esperaMin + 1) - 1 + esperaMin
- end if
- set lastMove to the timer
- end if
- end if
- end